<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: Sifteo::AssetSlot Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>Sifteo</b></li><li class="navelem"><a class="el" href="class_sifteo_1_1_asset_slot.html">AssetSlot</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="class_sifteo_1_1_asset_slot-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Sifteo::AssetSlot Class Reference<div class="ingroups"><a class="el" href="group__assets.html">Assets</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>AssetSlots are numbered containers, in a cube's flash memory, which can hold AssetGroups.  
 <a href="class_sifteo_1_1_asset_slot.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="group_8h_source.html">sifteo/asset/group.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad1521bb18cf4f7880f0bc39a7506c4fd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad1521bb18cf4f7880f0bc39a7506c4fd"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#ad1521bb18cf4f7880f0bc39a7506c4fd">AssetSlot</a> (_SYSAssetSlot sys)</td></tr>
<tr class="memdesc:ad1521bb18cf4f7880f0bc39a7506c4fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explicit conversion from a system object. <br/></td></tr>
<tr class="separator:ad1521bb18cf4f7880f0bc39a7506c4fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4515da105a44cdb2dc397bc6b9b852c5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4515da105a44cdb2dc397bc6b9b852c5"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#a4515da105a44cdb2dc397bc6b9b852c5">AssetSlot</a> (const <a class="el" href="class_sifteo_1_1_asset_slot.html">AssetSlot</a> &amp;other)</td></tr>
<tr class="memdesc:a4515da105a44cdb2dc397bc6b9b852c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <br/></td></tr>
<tr class="separator:a4515da105a44cdb2dc397bc6b9b852c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b53b2b558b5241667b1d0976b0cbb93"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__macros.html#gaa1dec568e79152c892dcf63f445cbd7a">ALWAYS_INLINE</a> <a class="el" href="class_sifteo_1_1_asset_slot.html">AssetSlot</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#a7b53b2b558b5241667b1d0976b0cbb93">bootstrap</a> (<a class="el" href="struct_sifteo_1_1_asset_group.html">AssetGroup</a> &amp;group) const </td></tr>
<tr class="memdesc:a7b53b2b558b5241667b1d0976b0cbb93"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark a particular <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> as a "bootstrap" asset for this slot.  <a href="#a7b53b2b558b5241667b1d0976b0cbb93">More...</a><br/></td></tr>
<tr class="separator:a7b53b2b558b5241667b1d0976b0cbb93"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3a63794dcc657e82e23c5adcbaf235b0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#a3a63794dcc657e82e23c5adcbaf235b0">erase</a> (_SYSCubeIDVector cubes=-1) const </td></tr>
<tr class="memdesc:a3a63794dcc657e82e23c5adcbaf235b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase this slot.  <a href="#a3a63794dcc657e82e23c5adcbaf235b0">More...</a><br/></td></tr>
<tr class="separator:a3a63794dcc657e82e23c5adcbaf235b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2249ea0a973d5effa10893a5ba39d31f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#a2249ea0a973d5effa10893a5ba39d31f">hasRoomFor</a> (const <a class="el" href="struct_sifteo_1_1_asset_group.html">AssetGroup</a> &amp;group, _SYSCubeIDVector cubes=-1) const </td></tr>
<tr class="memdesc:a2249ea0a973d5effa10893a5ba39d31f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Is there room in this slot to load a particular <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> without erasing the slot?  <a href="#a2249ea0a973d5effa10893a5ba39d31f">More...</a><br/></td></tr>
<tr class="separator:a2249ea0a973d5effa10893a5ba39d31f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aecf395975c0678cd281c9a70f64e9e91"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aecf395975c0678cd281c9a70f64e9e91"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#aecf395975c0678cd281c9a70f64e9e91">operator const _SYSAssetSlot &amp;</a> () const </td></tr>
<tr class="memdesc:aecf395975c0678cd281c9a70f64e9e91"><td class="mdescLeft">&#160;</td><td class="mdescRight">Implicit conversion to system object. <br/></td></tr>
<tr class="separator:aecf395975c0678cd281c9a70f64e9e91"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa16026837199dd623d54aff876b6740a"><td class="memItemLeft" align="right" valign="top">unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#aa16026837199dd623d54aff876b6740a">tilesFree</a> (_SYSCubeIDVector cubes=-1) const </td></tr>
<tr class="memdesc:aa16026837199dd623d54aff876b6740a"><td class="mdescLeft">&#160;</td><td class="mdescRight">How much space is remaining in this slot, measured in tiles?  <a href="#aa16026837199dd623d54aff876b6740a">More...</a><br/></td></tr>
<tr class="separator:aa16026837199dd623d54aff876b6740a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ac1a4535a9092c9c82b546871c63b168b"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="group__macros.html#gaa1dec568e79152c892dcf63f445cbd7a">ALWAYS_INLINE</a> <a class="el" href="class_sifteo_1_1_asset_slot.html">AssetSlot</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_asset_slot.html#ac1a4535a9092c9c82b546871c63b168b">allocate</a> ()</td></tr>
<tr class="memdesc:ac1a4535a9092c9c82b546871c63b168b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Statically allocate a new <a class="el" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a>.  <a href="#ac1a4535a9092c9c82b546871c63b168b">More...</a><br/></td></tr>
<tr class="separator:ac1a4535a9092c9c82b546871c63b168b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>AssetSlots are numbered containers, in a cube's flash memory, which can hold AssetGroups. </p>
<p>Slots are allocated statically. Any given game has a fixed number of slots that it requires. At launch or at cube connect-time, those slots are mapped to physical regions of memory on each cube, by the system.</p>
<p>Assets cannot be freely replaced within a slot. You can append a new <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> to a particular slot, and you can erase a slot. Individual groups cannot be removed without erasing the whole slot.</p>
<p>Assets within an <a class="el" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a> are cached between invocations of the game. This means that a "new" <a class="el" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a> may start out with not all tiles free, and any assets already resident in that slot will be marked as installed.</p>
<p>To define a new <a class="el" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a>, use <a class="el" href="class_sifteo_1_1_asset_slot.html#ac1a4535a9092c9c82b546871c63b168b" title="Statically allocate a new AssetSlot.">AssetSlot::allocate()</a>.</p>
<p>To ensure that AssetSlots used in metadata are constant at compile-time, the preferred allocation pattern is to declare a global variable such as: </p>
<pre class="fragment">AssetSlot MySlot = AssetSlot::allocate()
     .bootstrap(Group1)
     .bootstrap(Group2);
</pre><p>AssetSlots can only be created via <a class="el" href="class_sifteo_1_1_asset_slot.html#ac1a4535a9092c9c82b546871c63b168b" title="Statically allocate a new AssetSlot.">allocate()</a>, or copying another <a class="el" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a>. All ID allocation is performed in <a class="el" href="class_sifteo_1_1_asset_slot.html#ac1a4535a9092c9c82b546871c63b168b" title="Statically allocate a new AssetSlot.">allocate()</a>. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ac1a4535a9092c9c82b546871c63b168b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="group__macros.html#gaa1dec568e79152c892dcf63f445cbd7a">ALWAYS_INLINE</a> <a class="el" href="class_sifteo_1_1_asset_slot.html">AssetSlot</a> Sifteo::AssetSlot::allocate </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Statically allocate a new <a class="el" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a>. </p>
<p>This function returns a unique ID which is constant at link-time. </p>

</div>
</div>
<a class="anchor" id="a7b53b2b558b5241667b1d0976b0cbb93"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__macros.html#gaa1dec568e79152c892dcf63f445cbd7a">ALWAYS_INLINE</a> <a class="el" href="class_sifteo_1_1_asset_slot.html">AssetSlot</a> Sifteo::AssetSlot::bootstrap </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_sifteo_1_1_asset_group.html">AssetGroup</a> &amp;&#160;</td>
          <td class="paramname"><em>group</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Mark a particular <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> as a "bootstrap" asset for this slot. </p>
<p>The launcher will ensure that this <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> is installed before the game starts.</p>
<p>This function must be called before the <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> is used for rendering. This is where we update the asset's base address from the system cache.</p>
<p>Returns *this, so that <a class="el" href="class_sifteo_1_1_asset_slot.html#a7b53b2b558b5241667b1d0976b0cbb93" title="Mark a particular AssetGroup as a &quot;bootstrap&quot; asset for this slot.">bootstrap()</a> can be chained, especially off of <a class="el" href="class_sifteo_1_1_asset_slot.html#ac1a4535a9092c9c82b546871c63b168b" title="Statically allocate a new AssetSlot.">allocate()</a>. </p>

</div>
</div>
<a class="anchor" id="a3a63794dcc657e82e23c5adcbaf235b0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void Sifteo::AssetSlot::erase </td>
          <td>(</td>
          <td class="paramtype">_SYSCubeIDVector&#160;</td>
          <td class="paramname"><em>cubes</em> = <code>-1</code></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Erase this slot. </p>
<p>Any existing AssetGroups loaded into this slot will no longer be loaded, and the slot will be marked as fully empty.</p>
<p>After this call, any AssetGroups that were installed here will now return 'false' from isInstalled(). Any tiles rendered from this <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> will now have undefined contents on-screen.</p>
<p>By default, the slot will be erased on all cubes. A <a class="el" href="class_sifteo_1_1_cube_set.html" title="An unordered set of cubes.">CubeSet</a> may be explicitly specified, to limit the erasure to those cubes. </p>

</div>
</div>
<a class="anchor" id="a2249ea0a973d5effa10893a5ba39d31f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool Sifteo::AssetSlot::hasRoomFor </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_sifteo_1_1_asset_group.html">AssetGroup</a> &amp;&#160;</td>
          <td class="paramname"><em>group</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">_SYSCubeIDVector&#160;</td>
          <td class="paramname"><em>cubes</em> = <code>-1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Is there room in this slot to load a particular <a class="el" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> without erasing the slot? </p>
<p>This does not check whether the specified group has already been installed.</p>
<p>By default, this checks whether <em>all</em> cubes have room for the group. A <a class="el" href="class_sifteo_1_1_cube_set.html" title="An unordered set of cubes.">CubeSet</a> may be explicitly specified, to limit the check to those cubes. </p>

</div>
</div>
<a class="anchor" id="aa16026837199dd623d54aff876b6740a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">unsigned Sifteo::AssetSlot::tilesFree </td>
          <td>(</td>
          <td class="paramtype">_SYSCubeIDVector&#160;</td>
          <td class="paramname"><em>cubes</em> = <code>-1</code></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>How much space is remaining in this slot, measured in tiles? </p>
<p>By default, this measures the space remaining on all cubes, and returns the smallest of all results. A <a class="el" href="class_sifteo_1_1_cube_set.html" title="An unordered set of cubes.">CubeSet</a> may be explicitly specified, to limit the measurement to those cubes. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="group_8h_source.html">group.h</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
